﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Weibo.Data;

namespace Weibo.Business
{
    public class Province
    {
        public static IList<Entity.Province> GetLocationByPID(int pid)
        {
            using (DataTable dt = DatabaseProvider.GetInstance().GetLocationByPID(pid))
            {
                if (dt != null)
                {
                    IList<Entity.Province> list = DbTranslate.Translate<Entity.Province>(dt);
                    if (list != null && list.Count > 0)
                    {
                        return list;
                    }
                }
                return null;

            }
        }
        public static Entity.Province GetTypeByID(int id)
        {
            using (IDataReader dr = DatabaseProvider.GetInstance().GetLocationByID(id))
            {
                if (dr != null)
                {
                    IList<Entity.Province> list = DbTranslate.Translate<Entity.Province>(dr);
                    dr.Close();
                    if (list != null && list.Count > 0)
                    {
                        return list[0];
                    }
                }
                return null;

            }
        }
    }
}
